<!doctype html>
<html lang="en" data-bs-theme="auto" xmlns:th="http://www.thymeleaf.org">
<th:block th:insert="~{fragments/nav :: head(#{user_setting})}"></th:block>
<body>
 <th:block th:insert="~{fragments/nav :: search}"></th:block>
<div class="container-fluid">
  <div class="row">
   <th:block th:insert="~{fragments/nav :: menu}"></th:block>
    <main class="col-md-9 ms-sm-auto col-lg-10 px-md-4">
	  <th:block th:insert="~{fragments/nav :: breadcrumb}"></th:block>
      <div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
        <h1 class="h2" th:text="#{user_setting}">Setting</h1>
      </div>
      <h2 th:text="#{user_info}">User info</h2>
      <div class="table-responsive small">
        <table class="table table-striped table-sm" id="userinfo-body">
        </table>
      </div>      
    </main>
   <th:block th:insert="~{fragments/nav :: modalError}"></th:block>
   <th:block th:insert="~{fragments/nav :: modalConfirm}"></th:block>
  </div>
</div>
<th:block th:insert="~{fragments/nav :: scriptFunctions}"></th:block>
<script th:inline="javascript">
const userId = /*[[${userId}]]*/ '';

function logOut(result)
{
	if((result)&&(result.status)&&(result.status=="ok"))
		window.location.assign('/dc/web/logout');
}
const editableInfo =[
	{editableWhen: {column:'name',value:[[#{password2}]],fieldName:'Password'}, editableCallback: logOut, editableNotUseOldValue: 1},
	{editableWhen: {column:'name',value:[[#{login2}]],fieldName:'Login'}, editableCallback: logOut},
	{editableWhen: {column:'name',value:[[#{license_info2}]],fieldName:'License'}},
];
const columnsUserInfo = [
    { column: 'name', name:[[#{name_tb_device}]], width: '15%'},
    { column: 'value', name: [[#{content}]], style: 'width: 85%; word-wrap: break-word; word-break: break-all;', editable: editableInfo, fieldType: 'string',updateAction:'/dc/web/usersettingrefresh?action=userUpdate' }
];

const tableInput=[{tableData: 'userInfo', tableBody: 'userinfo-body', tableColumns: columnsUserInfo}];

excAction('/dc/web/usersettingrefresh', null,tableInput,null,true);

</script>
</body>
</html>
